package com.hmall.gateway.filter;

import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.gateway.filter.GatewayFilter;
import org.springframework.cloud.gateway.filter.factory.AbstractGatewayFilterFactory;
import org.springframework.stereotype.Component;

@Slf4j
@Component
public class PrintAnyGatewayFilterFactory extends AbstractGatewayFilterFactory {

    @Override
    public GatewayFilter apply(Object config) {
        return (exchange, chain) -> {
            // 获取请求
            // ServerHttpRequest request = exchange.getRequest();
            // 过滤器逻辑
            log.info("PrintAnyGatewayFilterFactory");
            // 放行
            return chain.filter(exchange);
        };
    }
}
